export const getBarChartOption = (data) => {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    },
    legend: {
      data: ['峰谷平衡电费收益', '售储模式增加收益', '现货侧批发降本收益', '储售损耗成本', '零售电费成本'],
      textStyle: {
        color: '#fff'
      },
      top: 0
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      data: [],

      axisLine: {
        lineStyle: {
          color: '#fff'
        }
      },
      axisLabel: {
        show: true,
        interval: 0,  // 强制显示所有标签
        inside: false,
        formatter: function (value) {
          return value;  // 确保显示完整值
        },
        hideOverlap: false,  // 防止标签重叠时自动隐藏
        rotate: 45,  // 旋转标签45度
        margin: 10   // 增加标签与轴线的距离
      },
    },
    yAxis: {
      type: 'value',
      axisLine: {
        lineStyle: {
          color: '#fff'
        }
      },

      splitLine: {
        lineStyle: {
          color: 'rgba(255,255,255,0.1)'
        }
      }
    },
    series: [
      {
        name: '售储模式增加收益',
        type: 'bar',
        stack: 'total',
        barWidth: '40%',
        emphasis: {
          focus: 'series'
        },
        data: [],
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [{
            offset: 0,
            color: '#fa8c16'
          }, {
            offset: 1,
            color: '#d46b08'
          }]
        }
      },
      {
        name: '现货侧批发降本收益',
        type: 'bar',
        stack: 'total',
        barWidth: '40%',
        emphasis: {
          focus: 'series'
        },
        data: [],
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [{
            offset: 0,
            color: '#3885e3'
          }, {
            offset: 1,
            color: '#4a8ee0'
          }]
        }
      },

      {
        name: '峰谷平衡电费收益',
        type: 'bar',
        stack: 'total',
        barWidth: '40%',
        emphasis: {
          focus: 'series'
        },
        data: [],
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [{
            offset: 0,
            color: '#1B4D89'
          }, {
            offset: 1,
            color: '#2A6EBF'
          }]
        }
      },
      {
        name: '储售损耗成本',
        type: 'bar',
        stack: 'total',
        barWidth: '40%',
        emphasis: {
          focus: 'series'
        },
        data: [],
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [{
            offset: 0,
            color: '#4fb0f7'
          }, {
            offset: 1,
            color: '#52b0f6'
          }]
        }
      },
      {
        name: '零售电费成本',
        type: 'bar',
        stack: 'total',
        barWidth: '40%',
        emphasis: {
          focus: 'series'
        },
        data: [],
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [{
            offset: 0,
            color: '#79b6e4'
          }, {
            offset: 1,
            color: '#7BC4F5'
          }]
        }
      }
    ]
  };
};
